Skip to main content

Write Range

AutomatR.DefaultActivities.WorkBook.WriteRange

The "Write Range" activity in AutomatR is part of the WorkBook activities package, allowing users to write data from a DataTable variable into a specified range within an Excel spreadsheet. This activity is useful for automating the population of Excel sheets with structured data.

Properties

NameDescription
Input
Data TableSpecifies the DataTable variable containing the data to be written into the Excel sheet. DataTable variables obtained from other activities, e.g., Read Range Result Variable.
Excel File PathSpecifies the full path of the Excel workbook on the local drive, including the filename (e.g., "C:\excelActivities\workbook.xlsx"). String variables containing the file path.
Include HeadersWhen enabled, considers column headers as the first row in the mentioned cell range. Boolean variables to enable or disable.
PasswordSpecifies the password for the workbook if required. Object variables containing the password.
Sheet NameSpecifies the name of the spreadsheet in which to write the data. String variables containing the sheet name.
Starting CellSpecifies the cell value to start writing the data. For example, "A1" for a single cell. String variables containing the starting cell.
Misc
Display NameProvides a customizable name for the activity displayed in the workflow. The display name enhances clarity and organization within the automation project. String variables containing the desired display name.
Optional
DelaySpecifies the amount of time (in seconds) to wait before executing the "Write Range" activity. This can be useful for handling synchronization issues. Integer variables containing the delay duration. Example: If the delay is 5 seconds, enter "5".

How to Use

  1. Drag and drop the "Write Range" activity onto the workflow.
  2. Configure the properties by specifying the Excel file path, sheet name, starting cell, and DataTable variable containing the data.
  3. Optionally, configure the delay, password, and header settings.
  4. Execute the workflow to write the specified data from the DataTable into the designated range in the Excel spreadsheet.

Example

Consider an example where the "Write Range" activity is used to write data from a DataTable variable named "OutputData" into cells starting from "B2" in a sheet named "DataSheet" in a workbook located at "C:\excelActivities\workbook.xlsx":

Write Range:
Excel File Path: "C:\excelActivities\workbook.xlsx"
Sheet Name: "DataSheet"
Starting Cell: "B2"
Password: "securepassword"
Header: true
Data Table: OutputData

In this example, the activity writes the data from the "OutputData" DataTable variable into cells starting from "B2" in the "DataSheet" and updates the Excel workbook accordingly.